from django.conf.urls.defaults import patterns
from os.path import abspath, dirname
from django.conf import settings

from django.contrib import admin
admin.autodiscover()

path_to_media = '%s/media/' % dirname(abspath(__file__))

# MEDIA Y ADMIN
urlpatterns = patterns('',
    (r'^admin/(.*)', admin.site.root),
)

# WWW
urlpatterns += patterns ('www.views',
    (r'^$', 'www_index'),
    (r'^login/$', 'www_login'),
    (r'^login/iniciar/$', 'www_login_iniciar'),
    (r'^logout/$', 'www_logout'),
    (r'^perfil/$', 'www_perfil'),
    (r'^perfil/actualizar/$', 'www_perfil_actualizar'),
)


if settings.DEBUG:
    urlpatterns += patterns('',
        (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': path_to_media}),
    )
